<template>
  <!-- 海景房组件 -->
  <div class="seaview">
    <div v-for="(i, index) in listTitle" :key="index" class="seaview__item">
      <div class="seaview__item__title">
        <img
          src="https://fast-learn.oss-cn-hangzhou.aliyuncs.com/tb/activityItemTitle.svg"
          alt="年货节"
        >
        <div>{{ i }}</div>
      </div>
      <van-image
        v-for="(item, idx) in seaviewList.slice(0, 2)"
        :key="idx"
        :class=" `seaview__item__img__${idx}` "
        :src="item.imageUrl"
      />
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      listTitle: ['聚划算', '直播', '有好货', '菜菜'],
      seaviewList: []
    }
  },

  watch: {
    '$store.state.homeList.seascape': {
      // 初次渲染立即获得一次数据
      immediate: true,
      handler(val) {
        this.seaviewList = val
      }
    }
  }
}
</script>

<style lang="less">
.seaview {
  margin: 12px 18px;
  background: #ffffff;
  border-radius: 24px;
  display: flex;
  flex-wrap: wrap;
  &__item {
    flex-wrap: wrap;

    width: 50%;
    &__title {
      display: flex;
      align-items: center;
      margin-top: 7px;
      margin-left: 12px;
      img {
        width: 83px;
      }
      div {
        font-size: 28px;
        color: #545454;
        font-weight: 500;
      }
    }
    &__img__0, &__img__1 {
      width: 50%;
      height: 50%;
      img {
        height: auto;
      }
    }

    &__img__0 {
      box-sizing: border-box;
      padding-left: 60px;
      padding-top: 13px;
    }
  }
}
</style>
